﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frmLista_Requerimiento.aspx.cs" Inherits="WebExportaciones.frmLista_Requerimiento" %>

<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
   <title>Mantenimiento de Requerimiento</title>
                  
    <link href="/css/style.css" rel="stylesheet"/>
    <link href="/css/default.css" rel="stylesheet"/>
    <link href="/css/custom.css" rel="stylesheet"/> 

    <link rel="stylesheet" href="/Javascript/jquery/css/smoothness/jquery-ui.min.css"/>
   <script src="/Javascript/jquery/js/jquery.js"></script>
   <script src="/Javascript/jquery/js/jquery-ui.min.js"></script>
   <script src="/Javascript/Jquery-Gen.js"></script>

    <script type="text/javascript">
        $(function () {
            $("#txtFechaInicio").datepicker();
            $("#txtFechaFin").datepicker({
                onSelect: function (date) {
                    $("#txtFechaInicio").datepicker("option", "maxDate", date);
                }
            });

            $("#txtFechaFin").on('blur', function () {
                if ($(this).val() != '') {
                    validarFechas();
                }
            });

            $("#txtFechaInicio").on('blur', function () {
                if ($(this).val() != '') {
                    validarFechas();
                }
            });
        });
   </script>   
   <script type="text/javascript">
       function VerMantenimiento(modo, dato) {
           var RetornoAnterior = window.returnValue;
           window.returnValue = undefined;
           var rpta = window.showModalDialog("frmMant_Requerimiento.aspx?modo=" + modo + "&Id=" + dato, "v1", "dialogWidth:1040px;dialogHeight:700px;dialogCenter:1;resizable:no");
           if (rpta == undefined) {
               rpta = window.returnValue;
           }
           window.returnValue = RetornoAnterior;

           if (rpta == '1') {
               document.getElementById("btnBuscar").click();
           }
       }

       function validarFechas() {
           if ($("#txtFechaFin").val() != '') {
               if ($("#txtFechaInicio").val() == '') {
                   alert("Error: La fecha de inicio debe tener un valor");
                   return false;
               }
           }

           if ($("#txtFechaInicio").val() != '') {
               if (!validaFechaDDMMAAAA($("#txtFechaInicio").val())) {
                   alert("Error: La fecha de inicio no es una fecha");
                   return false;
               }
           }

           if ($("#txtFechaFin").val() != '') {
               if (!validaFechaDDMMAAAA($("#txtFechaFin").val())) {
                   alert("Error: La fecha de fin no es una fecha");
                   return false;
               }
           }

           if (!validate_fechaMayorQue($("#txtFechaInicio").val(), $("#txtFechaFin").val())) {
               alert("Error: La fecha de inicio no debe ser mayor a la fecha fin");
               return false;
           }

           return true;
       }
   </script>

   <script type="text/javascript">
       function VerMantenimiento(modo, dato) {
           var RetornoAnterior = window.returnValue;
           window.returnValue = undefined;
           var rpta = window.open("frmMant_Requerimiento.aspx?modo=" + modo + "&Id=" + dato , "v1", "dialogWidth:1040px;dialogHeight:700px;dialogCenter:1;resizable:no");
           if (rpta == undefined) {
               rpta = window.returnValue;
           }
           window.returnValue = RetornoAnterior;

           if (rpta == '1') {
               document.getElementById("btnBuscar").click();
           }
       }
       function VerMantenimientoNuevo(modo, dato, nuevo) {
           
           var RetornoAnterior = window.returnValue;
           window.returnValue = undefined;
           
           var rpta = window.open("frmMant_Requerimiento.aspx?modo=" + modo + "&Id=" + dato + "&sNuevo=" + nuevo, "v1", "dialogWidth:1040px;dialogHeight:700px;dialogCenter:1;resizable:no");                      
           if (rpta == undefined) {
               rpta = window.returnValue;
           }
           window.returnValue = RetornoAnterior;

           if (rpta == '1') {
               document.getElementById("btnBuscar").click();
           }
       }
   </script>

    <style>

        .brand
        {
            float:left;
            top:-5px;
            position: absolute;
            margin-bottom:10px;
        }
        #menu{            
            background-image: url(/imagenes/fondomenu.png);
            background-repeat: no-repeat;
            background-position: top center;
            height: 72px;
            border-bottom: 0px;            
            display:block;
            border:0;
        }

        #menu img
        {
            border:0;
        }
        #button {            
            padding: 0;
        }

        #button li {
            display: inline;
        }

        #button li a {
            font-family: Arial ;
            font-size:15px;
            text-decoration: none;
            float:right;                                
            color: #fff;
       }
        
        #button li a:hover {
            background-color: #2586d7;               
            font-weight:bold;
        }

        .btn_nuevo
        {
            background-image: url(/imagenes/nuevo.png);
            background-repeat: no-repeat;
            width:69px;
            height:29px;
            border:0;
            margin:0;
            padding:0;
        }

        .btn_eliminar
        {
            background-image: url(/imagenes/eliminar.png);
            width:80px;
            height:29px;
            background-repeat: no-repeat;
            border:0;
            margin:0;
            padding:0;
        }

        .btn_buscar
        {
            background-image: url(/imagenes/buscar.png);
            background-repeat: no-repeat;
            width:69px;
            height:29px;
            border:0;
            margin:0;
            padding:0;
        }
        .label {
            font-family: ‘Lucida Sans Unicode’, ‘Lucida Grande’, sans-serif;
            font-size:11px;
            font-weight:bold;
            color:#6B6B6B;
        }
        input[type=text] {
            font-family: ‘Lucida Sans Unicode’, ‘Lucida Grande’, sans-serif;
            font-size:10px;
            color:#6B6B6B;
        }
        select {
            font-family: ‘Lucida Sans Unicode’, ‘Lucida Grande’, sans-serif;
            font-size:10px;
            color:#6B6B6B;
        }
        h2 {
            font-family: 'Open sans',sans-serif;
            color: #888888;            
            margin-bottom: 5px;
            text-align: center;
            line-height: 17px;
        }

    </style>

    
</head>
<body>
   <form id="_frmLista_Requerimiento" runat="server">
      <div>
         <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
         <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>

               <!-- INICIO -->
                <div id="menu">
                    <a class="brand" href="http://www.etna.com.pe/etna2013/">
			            <img src="/imagenes/logo.png" alt="">
			        </a>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ul id="button">
                        <li><a href="/frmLista_Requerimiento.aspx">Mis Requerimientos</a></li>
                    </ul>
                </div>
               <!-- FIN --> 

               <table style="width:100%;">
                  <tr>
                     <td>
                        <h2 style="text-align: center">Listado de Requerimientos</h2>
                     </td>
                  </tr>
                  <tr>
                     <td>
                        <table style="width:100%">
                           <tr>
                              <td>
                                 <table style="border: 1px inset #CCC; border-radius:0 5px; width: 100%; border-spacing: 0px; padding: 3px 4px 3px 4px;">
                                    <tr style="border-style: none; border-width: 0px;">
                                       <td style="border-style: none; margin-left:2px; margin-right:2px;width:15%;text-align:right" class="auto-style3">
                                           <label class="label">N° de Requerimiento:</label>
                                       </td>
                                       <td style="border-style: none; width:30%">
                                          <asp:TextBox ID="txtNumRequerimiento" runat="server"  OnTextChanged="AccionBuscar" ClientIDMode="Static"></asp:TextBox>
                                       </td>                              
                                        <td style="border-style: none; margin-left:2px; margin-right:2px;width:15%;text-align:left" class="auto-style3">
                                           <label class="label">Descripción:</label>
                                       </td>
                                       <td style="border-style: none; width:30%">
                                          <asp:TextBox ID="txtDescripcion" runat="server" Width="100%"  OnTextChanged="AccionBuscar" ClientIDMode="Static"></asp:TextBox>
                                       </td>                                                   
                                    </tr>                                    
                                    <tr style="border-style: none; border-width: 0px;">
                                        <td style="border-style: none; margin-left:2px; margin-right:2px;width:15%; text-align:right" class="auto-style3">
                                           <label class="label">Fecha de Inicio:</label>
                                        </td>
                                        <td style="border-style: none; width:30%">
                                            <asp:TextBox ID="txtFechaInicio" runat="server"></asp:TextBox>
                                        </td>   
                                        <td style="border-style: none; margin-left:2px; margin-right:2px; width:15%; text-align:right; width:2000px;">
                                           <label class="label">Fecha de Fin:</label>
                                        </td>
                                        <td style="border-style: none; width:30%">
                                            <asp:TextBox ID="txtFechaFin" runat="server"></asp:TextBox>
                                        </td>   
                                    </tr>
                                     <tr style="border-style: none; border-width: 0px;">
                                       <td style="border-style: none; margin-left:2px; margin-right:2px; width:15%; text-align:left" class="auto-style3">
                                           <label class="label">Estado de Requerimiento:</label>
                                       </td>
                                       <td style="border-style: none;" colspan="2">
                                           <asp:DropDownList ID="ddlEstadoRequerimiento" runat="server" DataTextField="sDescripcion" DataValueField="idEstado"/>                                                                                          
                                       </td>    
                                       <td style="text-align: left;  border-width: 0px; border-spacing: inherit;" class="auto-style1"> 
                                           <asp:Button ID="Button1" runat="server" CssClass="btn_buscar" OnClick="AccionBuscar" OnClientClick="return validarFechas();" ClientIDMode="Static" />
                                       </td>                                                                            
                                    </tr>                                     
                                 </table>
                                 <table style="width: 100%; height: 50px;">
                                    <tr>
                                       <td style="width: 50%; text-align: center;">
                                          <asp:Button ID="btnNuevo" runat="server"  CssClass="btn_nuevo" OnClick="AccionNuevo" ClientIDMode="Static"  />
                                       </td>                                                                               
                                    </tr>
                                 </table>
                              </td>
                           </tr>
                           <tr style="height:310px; background-color:#EEEEEE; vertical-align:top; border:solid;">
                              <td>
                                 <asp:GridView ID="gvRequerimiento" runat="server" AutoGenerateColumns="False" AllowPaging="True" DataKeyNames="idRequerimiento"
                                       BackColor="#EEEEEE" BorderColor="#AAAAAA" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2"
                                       EnableViewState="False" onpageindexchanging="Paginar"
                                       Width="100%"  OnRowCommand="gvRequerimiento_RowCommand" OnSelectedIndexChanged="gvRequerimiento_SelectedIndexChanged" OnRowDeleting="gvRequerimiento_RowDeleting" >
                                    <AlternatingRowStyle BackColor="#EEEEEE" />
                                    <Columns>
                                                                               
                                       <asp:BoundField DataField="idRequerimiento" HeaderText="Código" SortExpression="idRequerimiento">
                                          <HeaderStyle Wrap="False" />
                                          <ItemStyle HorizontalAlign ="Right" Wrap="False"  Width="50px"/>
                                       </asp:BoundField>
                                        <asp:BoundField DataField="sDescripcion" HeaderText="Descripción" SortExpression="sDescripcion">
                                          <HeaderStyle Wrap="False" />
                                          <ItemStyle HorizontalAlign ="Right" Wrap="False"  Width="50px"/>
                                       </asp:BoundField>
                                        
                                        <asp:BoundField DataField="sestadoRequerimiento" HeaderText="Estado" SortExpression="sestadoRequerimiento">
                                          <HeaderStyle Wrap="False" />
                                          <ItemStyle HorizontalAlign ="Right" Wrap="False" Width="50px" />
                                       </asp:BoundField>
                                                                                                                                                             
                                        <asp:BoundField DataField="dfechaRequerimiento" HeaderText="Fecha Requerimiento" DataFormatString="{0:d}" SortExpression="dfechaRequerimiento">
                                          <HeaderStyle Wrap="False" />
                                          <ItemStyle HorizontalAlign ="Center" Wrap="False" Width="150px"/>
                                       </asp:BoundField>

                                        <asp:BoundField DataField="dfechaEntrega" HeaderText="Fecha Entrega" DataFormatString="{0:d}"  SortExpression="dfechaEntrega">
                                          <HeaderStyle Wrap="False" />
                                          <ItemStyle HorizontalAlign ="Center" Wrap="False" Width="150px" />
                                       </asp:BoundField> 
                                       
                                       <asp:ButtonField ButtonType="Image" runat="server" HeaderText="Modificar" CommandName="Select" ImageUrl="/Imagenes/edit.gif" Text="Modificar"  ControlStyle-Width="16px" ItemStyle-Width="20px" >
                                       <ControlStyle Width="16px" />
                                       <ItemStyle Width="20px" />
                                       </asp:ButtonField> 

                                        <asp:ButtonField  ButtonType="Image" runat="server" HeaderText="Eliminar"  CommandName="Delete" ImageUrl="/Imagenes/delete.gif" Text="Modificar"  ControlStyle-Width="16px" ItemStyle-Width="20px" >
                                       <ControlStyle Width="16px" />
                                       <ItemStyle Width="20px" />
                                       </asp:ButtonField>

                                    </Columns>
                                    <HeaderStyle BackColor="#AAAAAA" Font-Bold="True" ForeColor="Black" />
                                    <PagerSettings Visible="False" />
                                    <RowStyle BackColor="White" ForeColor="#000000" />
                                    <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
                                    <SortedAscendingCellStyle BackColor="#FFF1D4" />
                                    <SortedAscendingHeaderStyle BackColor="#B95C30" />
                                    <SortedDescendingCellStyle BackColor="#F1E5CE" />
                                    <SortedDescendingHeaderStyle BackColor="#93451F" />
                                 </asp:GridView>
                              </td>
                           </tr>
                           <tr>
                              <td>
                                 <table style="width:100%;">
                                    <tr>
                                       <td style="color: #FF6600">
                                          &nbsp;P&aacute;gina&nbsp;<asp:TextBox ID="txtPagina" runat="server" Width="50px" OnTextChanged="EventoTecladoTxtPagina" ClientIDMode="Static"></asp:TextBox> de <asp:Label ID="lblTotalPaginas" runat="server" Text="0"  ClientIDMode="Static"></asp:Label>
                                       </td>
                                       <td style="text-align: center;">
                                          <asp:Button ID="btnPrimero" runat="server" OnClick="Paginar" Text="Primero" BackColor="White" BorderColor="#FF6600" BorderStyle="Solid" ForeColor="#FF6600" CommandArgument="-2" />&nbsp;
                                          <asp:Button ID="btnPrevio" runat="server" OnClick="Paginar" Text="Previo" BackColor="White" BorderColor="#FF6600" BorderStyle="Solid" ForeColor="#FF6600" CommandArgument="-1"/>&nbsp;
                                          <asp:Button ID="btnPagina1" runat="server" OnClick="Paginar" Text="1" BackColor="White" BorderColor="#FF6600" BorderStyle="Solid" ForeColor="#FF6600" CommandArgument="1"/>&nbsp;
                                          <asp:Button ID="btnPagina2" runat="server" OnClick="Paginar" Text="2" BackColor="White" BorderColor="#FF6600" BorderStyle="Solid" ForeColor="#FF6600" CommandArgument="2"/>&nbsp;
                                          <asp:Button ID="btnPagina3" runat="server" OnClick="Paginar" Text="3" BackColor="White" BorderColor="#FF6600" BorderStyle="Solid" ForeColor="#FF6600" CommandArgument="3"/>&nbsp;
                                          <asp:Button ID="btnPagina4" runat="server" OnClick="Paginar" Text="4" BackColor="White" BorderColor="#FF6600" BorderStyle="Solid" ForeColor="#FF6600" CommandArgument="4"/>&nbsp;
                                          <asp:Button ID="btnPagina5" runat="server" OnClick="Paginar" Text="5" BackColor="White" BorderColor="#FF6600" BorderStyle="Solid" ForeColor="#FF6600" CommandArgument="5"/>&nbsp;
                                          <asp:Button ID="btnSiguiente" runat="server" OnClick="Paginar" Text="Siguiente" BackColor="White" BorderColor="#FF6600" BorderStyle="Solid" ForeColor="#FF6600" CommandArgument="+1"/>&nbsp;
                                          <asp:Button ID="btnUltimo" runat="server" OnClick="Paginar" Text="Ultimo" BackColor="White" BorderColor="#FF6600" BorderStyle="Solid" ForeColor="#FF6600" CommandArgument="+2"/>
                                          <asp:HiddenField ID="hdfPaginaActual" runat="server"  ClientIDMode="Static" />
                                          <asp:HiddenField ID="hdfModoMantenimiento" runat="server" ClientIDMode="Static" />
                                          <asp:HiddenField ID="hdfParametroID" runat="server" ClientIDMode="Static" />
                                       </td>
                                       <td style="text-align: right; margin-right: 10px; color: #FF6600">
                                          Total de registros: <asp:Label ID="lblTotalRegistros" runat="server" Text="0"></asp:Label>&nbsp;
                                       </td>
                                    </tr>
                                 </table>
                              </td>
                           </tr>
                        </table>
                     </td>
                  </tr>
                  <tr style="height:5px; font-size:x-small;">
                     <td></td>
                  </tr>
                  <tr>
                     <td>
                        <table style="background-color: #FFCCCC; border: 1px solid #FF9999; color: #FF0000; width:100%" >
                           <tr>
                              <td style="text-align: center">
                                 <asp:Label ID="lblMensajeError" runat="server" Text=""></asp:Label>
                              </td>
                           </tr>
                        </table>
                     </td>
                  </tr>
                  <tr style="height:5px; font-size:x-small;">
                     <td></td>
                  </tr>
               </table>
            </ContentTemplate>
            <Triggers>
               <asp:AsyncPostBackTrigger ControlID="gvRequerimiento" EventName="SelectedIndexChanged">
               </asp:AsyncPostBackTrigger>
            </Triggers>
         </asp:UpdatePanel>
      </div>
   </form>
</body>
</html>
